public class Test1 {
    public static void main(String[] args) {
        MyTimer timer=new MyTimer();
        Thread thread1=new Thread(()->{

            timer.schedule(new Runnable() {
                @Override
                public void run() {
                    System.out.println("good");
                }
            },1000);
        });


        Thread thread2=new Thread(()->{

            timer.schedule(new Runnable() {
                @Override
                public void run() {
                    System.out.println("nice");
                }
            },2000);
        });
        thread1.start();
        thread2.start();
        try {
            thread1.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        try {
            thread2.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
